#include<bits/stdc++.h>
using namespace std;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n,r[100005];
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&r[i]);
    sort(r+1,r+n+1);
    int mid=ceil(n*1.0/2),ans=n;
    if(n%2==0){
        for(int i=mid+1;i<=n;i++){
            int j=mid;
            if(r[i]!=r[j]) ans--;
            j--;
        }
    }
    else{
        for(int i=mid+1;i<=n;i++){
            int j=mid-1;
            if(r[i]!=r[j]) ans--;
            j--;
        }
        ans--;
    }
    printf("%d",ans);
    return 0;
}
